import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    name: "锁管理",
    redirect: "page1",
    component: () => import('../views/index'),
    children: [
      {
        path: "/page1",
        name: "查询锁",
        component: () => import('../views/Page1')
      },
      {
        path: "/page2",
        name: "增加锁",
        component: () => import('../views/Page2')
      }
    ]
  },
  {
    path: "/nav2",
    name: "导航2",
    component: () => import('../views/index'),
    children: [
      {
        path: "/page3",
        name: "page3",
        component: () => import('../views/Page3')
      },
      {
        path: "/page4",
        name: "page4",
        component: () => import('../views/Page4')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
